home *** CD-ROM | disk | FTP | other *** search
/ X User Tools / X User Tools (O'Reilly and Associates)(1994).ISO / sun4c / archive / tcltk.z / tcltk / man / cat3 / GetFontStr.3 < prev    next >
Text File  |  1994-09-20  |  4KB  |  133 lines

  1.  
  2.  
  3.  
  4. Tk_GetFontStruct(3)   Tk Library Procedures
  5.  
  6.  
  7.  
  8. _________________________________________________________________
  9.  
  10. NAME
  11.      Tk_GetFontStruct, Tk_NameOfFontStruct,  Tk_FreeFontStruct  -
  12.      maintain database of fonts
  13.  
  14. SYNOPSIS
  15.      #include <tk.h>
  16.  
  17.      XFontStruct *
  18.      Tk_GetFontStruct(_i_n_t_e_r_p, _t_k_w_i_n, _n_a_m_e_I_d)
  19.  
  20.      char *
  21.      Tk_NameOfFontStruct(_f_o_n_t_S_t_r_u_c_t_P_t_r)
  22.  
  23.      Tk_FreeFontStruct(_f_o_n_t_S_t_r_u_c_t_P_t_r)
  24.  
  25. ARGUMENTS
  26.      Tcl_Interp    *_i_n_t_e_r_p          (in)      Interpreter to  use
  27.                                               for  error  report-
  28.                                               ing.
  29.  
  30.      Tk_Window     _t_k_w_i_n            (in)      Token for window in
  31.                                               which  font will be
  32.                                               used.
  33.  
  34.      Tk_Uid        _n_a_m_e_I_d           (in)      Name   of   desired
  35.                                               font.
  36.  
  37.      XFontStruct   *_f_o_n_t_S_t_r_u_c_t_P_t_r   (in)      Font  structure  to
  38.                                               return  name for or
  39.                                               delete.
  40. _________________________________________________________________
  41.  
  42.  
  43. DESCRIPTION
  44.      Tk_GetFont loads the font indicated by _n_a_m_e_I_d and returns  a
  45.      pointer to information about the font.  The pointer returned
  46.      by Tk_GetFont will remain valid until Tk_FreeFont is  called
  47.      to release it.  _N_a_m_e_I_d can be either a font name or pattern;
  48.      any value that could be  passed  to  XLoadQueryFont  may  be
  49.      passed   to   Tk_GetFont.   If  Tk_GetFont  is  unsuccessful
  50.      (because, for example, there is  no  font  corresponding  to
  51.      _n_a_m_e_I_d)  then it returns NULL and stores an error message in
  52.      _i_n_t_e_r_p->_r_e_s_u_l_t.
  53.  
  54.      Tk_GetFont maintains a database of all fonts  it  has  allo-
  55.      cated.  If the same _n_a_m_e_I_d is requested multiple times (e.g.
  56.      by different windows or for different purposes), then  addi-
  57.      tional  calls  for  the  same  _n_a_m_e_I_d  will  be handled very
  58.      quickly, without involving the X server.  For  this  reason,
  59.      it  is  generally  better  to  use  Tk_GetFont in place of X
  60.  
  61.  
  62.  
  63. Tk                                                              1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. Tk_GetFontStruct(3)   Tk Library Procedures
  71.  
  72.  
  73.  
  74.      library procedures like XLoadQueryFont.
  75.  
  76.      The procedure Tk_NameOfFontStruct is roughly the inverse  of
  77.      Tk_GetFontStruct.  If its _f_o_n_t_S_t_r_u_c_t_P_t_r argument was created
  78.      by Tk_GetFontStruct, then the return  value  is  the  _n_a_m_e_I_d
  79.      argument  that  was passed to Tk_GetFontStruct to create the
  80.      font.  If  _f_o_n_t_S_t_r_u_c_t_P_t_r  was  not  created  by  a  call  to
  81.      Tk_GetFontStruct,  then  the  return  value is a hexadecimal
  82.      string giving the X  identifier  for  the  associated  font.
  83.      Note:   the  string  returned by Tk_NameOfFontStruct is only
  84.      guaranteed   to   persist   until   the   next    call    to
  85.      Tk_NameOfFontStruct.
  86.  
  87.      When a font returned by  Tk_GetFont  is  no  longer  needed,
  88.      Tk_FreeFont should be called to release it.  There should be
  89.      exactly one call to Tk_FreeFont for each call to Tk_GetFont.
  90.      When  a  font is no longer in use anywhere (i.e. it has been
  91.      freed as many times as it has been gotten) Tk_FreeFont  will
  92.      release it to the X server and delete it from the database.
  93.  
  94.  
  95. KEYWORDS
  96.      font
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129. Tk                                                              2
  130.  
  131.  
  132.  
  133.